package com.yuyu.commons.toolKit;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;

/**
 * @author
 * @version 1.0
 * @description: 分布式事务工具类
 * @date 2022/12/12 13:55
 */
public class TccUtil {

    //hashBasedTable 可以用两个key标记一个值
    private static final Table<Class<?>, String, Long> map = HashBasedTable.create();

    public static void add(Class<?> clazz, String xid, Long marker){
        map.put(clazz, xid, marker);
    }

    public static Long get(Class<?> clazz, String xid){
      return map.get(clazz, xid);
    }

    public static void remove(Class<?> clazz, String xid){
        map.remove(clazz, xid);
    }

}
